﻿@{
    ViewBag.Title = "日志管理_系统异常情况查询";
}
<script type="text/javascript">

    var LastSelectID_exception = 0; //最后一次选中的行ID
    var user_exception;
    var createDate_exception;
    var errorInfo_exception;
    var List_Permission_Log_QueryExceptionHeight = 0;
    $(document).ready(function () {
        List_Permission_Log_QueryExceptionHeight = $("#tabContent").innerHeight() - $(".panelBar").height();
        GridGet_QueryException();
    });
    
    function GridGet_QueryException() {
        $("#List_Permission_Log_QueryException").jqGrid({
            url: "/Permission/Log/QueryByException",
            datatype: "json",
            mtype: "post",
            colNames: ['Id', '发生时间', '异常信息','异常信息', '异常信息来源','异常信息描述', '异常信息描述', '创建者'],
            colModel: [
                        { name: 'LogId', index: 'LogId', width: 1, align: "center", sortable: false, hidden: true },
                        { name: 'CreateOn', index: 'CreateOn', formatter: 'date', formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' }, datefmt: 'Y-m-d H:i:s', width: 130, align: "center", sortable: false },
                        { name: 'Message', index: 'Message1', width: 10, align: "center", hidden: true},
                        { name: 'Message', index: 'Message', width: 200, align: "center",formatter:formatData1, sortable: false },
                        { name: 'ThreadName', index: 'ThreadName', width: 120, align: "center", sortable: false },
                        { name: 'FormattedMessage', index: 'FormattedMessage1', hidden: true},
                        { name: 'FormattedMessage', index: 'FormattedMessage', width: 120, formatter: formatData2, align: "center", sortable: false },
                        { name: 'CreateBy', index: 'CreateBy', width: 90, align: "center", sortable: false }
                       ],
            loadError: function (xhr, status) {
                alertMsg.error(xhr.responseText);
            },
            loadComplete: function (xhr) {
                var ajaxbg = $("#background,#progressBar,#lui_List_Permission_Log_QueryException");
                ajaxbg.hide();
            },
            onSelectRow: GetExceptionIds,
            autowidth: true,
            shrinkToFit: true,
            multiselect: false,
            sortable: false,
            viewrecords: true,
            sortorder: "desc",
            jsonReader: {
                repeatitems: false
            },
            rowNum: 20,
            altRows: true,
            pager: '#pager_Permission_Log_QueryException',
            rowList: [20, 50, 100],
            height: List_Permission_Log_QueryExceptionHeight - 65
        }).navGrid('#pager_Permission_Log_QueryException', { edit: false, add: false, del: false, refresh: false, search: false });
    }
    function formatData1(cellvalue, options, rowObject) {
        if (cellvalue.length > 40)
            return cellvalue.substring(0, 40) + "...";
        else
            return cellvalue;
    }
    function formatData2(cellvalue, options, rowObject) {
        if (cellvalue.length > 35)
            return cellvalue.substring(0, 35) + "...";
        else
            return cellvalue;
    }
    //选中某一行，获得行
    function GetExceptionIds() {
        var GridObj_QueryException = $("#List_Permission_Log_QueryException");
        var logId_log = GridObj_QueryException.jqGrid("getGridParam", "selrow");
        if (logId_log == "")
            return "";
        var temp_log = GridObj_QueryException.getCell(parseInt(logId_log), "LogId").toString();
        if (temp_log != "" && temp_log != "false") {
            $("#select_Permission_Log_ExceptionDetails").attr("href", "/Permission/Log/ExceptionDetails/" + temp_log);
            user_exception = GridObj_QueryException.getCell(parseInt(logId_log), "CreateBy").toString();
            createDate_exception = GridObj_QueryException.getCell(parseInt(logId_log), "CreateOn").toString();
            errorInfo_exception = GridObj_QueryException.getCell(parseInt(logId_log), "Message").toString() + "<br/>" + GridObj_QueryException.getCell(parseInt(logId_log), "FormattedMessage").toString();
        }
        return logId_log;
    }
</script>
<div class="page">
    @*顶部按钮*@
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="edit" id="select_Permission_Log_ExceptionDetails" href="javascript:void(0);" target="dialog" rel="dialog_permisson_log_exception" title="异常详情" mask="true" width="600" height="350">
                <span>查看详情</span></a></li>
        </ul>
    </div>
    <div id="mainContent_Permission_Log_QueryException">        
        <div class="tableList" layouth="28">
            <table id="List_Permission_Log_QueryException">
            </table>
            <div id="pager_Permission_Log_QueryException">
            </div>
        </div>
    </div>
</div>
